import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Test;


public class QuizTest
{

	@Test
	public void testQuizWrite() throws IOException
	{
		Quiz quiz = new Quiz("A", "A.qz");
		
		Question q1 = new Question("Addition", "2 + 1 = ?", "a.jpg");
		q1.setSelection(0, new String("1"));
		q1.setSelection(1, "0");
		q1.setSelection(2, "3");
		q1.setSelection(3, "6");
		q1.setAnswer(2);
		
		Question q2 = new Question("Fractions", "Choose the correct fraction from the picture", "b.jpg");
		q2.setSelection(0, "1/3");
		q2.setSelection(1, "1/4");
		q2.setSelection(2, "3/4");
		q2.setSelection(3, "1/2");
		q2.setAnswer(1);
		
		Question q3 = new Question("Reading", "Select the correct spelling", "b.jpg");
		q3.setSelection(0, "a");
		q3.setSelection(1, "aa");
		q3.setSelection(2, "aaa");
		q3.setSelection(3, "aaaa");
		q3.setAnswer(3);
		
		quiz.addQuestion(q1);
		quiz.addQuestion(q2);
		quiz.addQuestion(q3);
		
		quiz.write();
	}
	
	@Test
	public void testQuizRead() throws IOException
	{
		Quiz quiz = new Quiz("A.qz");
		quiz.read();
		quiz.setFilename("B.qz");
		quiz.write();
	}
	
}
